package sprinklerbee.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import sprinklerbee.dao.ConfigurationDAO;
import sprinklerbee.dao.ConfigurationDAOImpl;
import sprinklerbee.model.Configuration;

public class ConfigurationService {
	private ConfigurationDAO configurationDAO=new ConfigurationDAOImpl();
	
	public Map<String, Configuration> getConfigurations() throws RuntimeException{
		List<Configuration> list=configurationDAO.queryConfigurations();
		Map<String, Configuration> map=new HashMap<String, Configuration>();
		map.put("waterflow", list.get(0));
		map.put("mintemp", list.get(1));
		map.put("maxtemp", list.get(2));
		//map.put("frequency", list.get(3));
		//map.put("duration", list.get(4));
		return map;
	}
	
	public boolean updateConfigurations(Map<String, String> map) throws RuntimeException{
		return configurationDAO.updateConfig(map);
	}
}
